from flask import Flask,session
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy
from redis import StrictRedis
from flask_wtf.csrf import CSRFProtect
from flask_script import Manager
from flask_migrate import Migrate,MigrateCommand
from config import config_dict
from info import create_app,db

app = create_app('development')

# app = Flask(__name__)

# class Config(object):
#     DEBUG = True
#
#     SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306:information21'
#     SQLALCHEMY_TRACK_MODIFICATIONS = False
#
#     REDIS_HOST = '127.0.0.1'
#     REDIS_PORT = 6379
#
#     SESSION_TYPE = 'redis'
#     SESSION_REDIS = StrictRedis(REDIS_HOST,REDIS_PORT)
#     SESSION_KEY = 'shfoglengojxogps'
#     SESSION_USE_SIGNER = True
#     SESSION_PERMANENT = False
#     PERMANNET_SESSION_LIFETME = 86400


#
# config_class = config_dict['development']
# app.config.from_object(config_class)
#
# db = SQLAlchemy(app)
#
# redis_store = StrictRedis(host=config_class.REDIS_HOST,port=config_class.REDIS_PORT)
#
# CSRFProtect(app)
#
# Session(app)


manager = Manager(app)

Migrate(app,db)

manager.add_command('db',MigrateCommand)


# @app.route('/')
# def helloworld():
#     return "hello world"


if __name__ == '__main__':
    # app.run()
    manager.run()